<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>DevOps | To Share</title>
    <meta name="generator" content="VuePress 1.9.7">
    <link rel="icon" href="/share/favicon.ico">
    <meta name="description" content="分享风雨，享受阳光">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    
    <link rel="preload" href="/share/assets/css/0.styles.d7affcea.css" as="style"><link rel="preload" href="/share/assets/js/app.706684de.js" as="script"><link rel="preload" href="/share/assets/js/3.4685d505.js" as="script"><link rel="preload" href="/share/assets/js/1.b12738fb.js" as="script"><link rel="preload" href="/share/assets/js/53.c0420367.js" as="script"><link rel="preload" href="/share/assets/js/9.4e81f08e.js" as="script"><link rel="prefetch" href="/share/assets/js/10.9e95ce7b.js"><link rel="prefetch" href="/share/assets/js/11.e99410dc.js"><link rel="prefetch" href="/share/assets/js/12.e9afe07c.js"><link rel="prefetch" href="/share/assets/js/13.078dd281.js"><link rel="prefetch" href="/share/assets/js/14.6575b8f0.js"><link rel="prefetch" href="/share/assets/js/15.d942bb10.js"><link rel="prefetch" href="/share/assets/js/16.fd8cc40c.js"><link rel="prefetch" href="/share/assets/js/17.f1b1f2c6.js"><link rel="prefetch" href="/share/assets/js/18.b312ce79.js"><link rel="prefetch" href="/share/assets/js/19.a99d170f.js"><link rel="prefetch" href="/share/assets/js/20.cda2b911.js"><link rel="prefetch" href="/share/assets/js/21.d6062607.js"><link rel="prefetch" href="/share/assets/js/22.5a50eee4.js"><link rel="prefetch" href="/share/assets/js/23.be601eed.js"><link rel="prefetch" href="/share/assets/js/24.3d0b9811.js"><link rel="prefetch" href="/share/assets/js/25.c1c35d96.js"><link rel="prefetch" href="/share/assets/js/26.9a8b03ff.js"><link rel="prefetch" href="/share/assets/js/27.6c302f3e.js"><link rel="prefetch" href="/share/assets/js/28.5eb55960.js"><link rel="prefetch" href="/share/assets/js/29.8297842b.js"><link rel="prefetch" href="/share/assets/js/30.b453256b.js"><link rel="prefetch" href="/share/assets/js/31.6ce2e46f.js"><link rel="prefetch" href="/share/assets/js/32.cf3906ab.js"><link rel="prefetch" href="/share/assets/js/33.83680f76.js"><link rel="prefetch" href="/share/assets/js/34.dada508c.js"><link rel="prefetch" href="/share/assets/js/35.11a36f17.js"><link rel="prefetch" href="/share/assets/js/36.fc43ef74.js"><link rel="prefetch" href="/share/assets/js/37.af715eba.js"><link rel="prefetch" href="/share/assets/js/38.7ba3e6e1.js"><link rel="prefetch" href="/share/assets/js/39.cd1c9d09.js"><link rel="prefetch" href="/share/assets/js/4.c1f99423.js"><link rel="prefetch" href="/share/assets/js/40.8df0c044.js"><link rel="prefetch" href="/share/assets/js/41.e643a418.js"><link rel="prefetch" href="/share/assets/js/42.d809cd4f.js"><link rel="prefetch" href="/share/assets/js/43.5136999f.js"><link rel="prefetch" href="/share/assets/js/44.315a82bf.js"><link rel="prefetch" href="/share/assets/js/45.a4b04306.js"><link rel="prefetch" href="/share/assets/js/46.2e8ec77e.js"><link rel="prefetch" href="/share/assets/js/47.d6bde2ca.js"><link rel="prefetch" href="/share/assets/js/48.e8e85c15.js"><link rel="prefetch" href="/share/assets/js/49.fce2ff19.js"><link rel="prefetch" href="/share/assets/js/5.599dfd12.js"><link rel="prefetch" href="/share/assets/js/50.3918e713.js"><link rel="prefetch" href="/share/assets/js/51.c5ddf50e.js"><link rel="prefetch" href="/share/assets/js/52.b6653f73.js"><link rel="prefetch" href="/share/assets/js/54.0f64522f.js"><link rel="prefetch" href="/share/assets/js/55.1f9ce6fb.js"><link rel="prefetch" href="/share/assets/js/56.0a2fc30f.js"><link rel="prefetch" href="/share/assets/js/57.3b81efcb.js"><link rel="prefetch" href="/share/assets/js/58.c617dcad.js"><link rel="prefetch" href="/share/assets/js/59.5239e9d4.js"><link rel="prefetch" href="/share/assets/js/6.4e5676a9.js"><link rel="prefetch" href="/share/assets/js/60.b614d70b.js"><link rel="prefetch" href="/share/assets/js/61.f45be005.js"><link rel="prefetch" href="/share/assets/js/62.52121455.js"><link rel="prefetch" href="/share/assets/js/63.9f699597.js"><link rel="prefetch" href="/share/assets/js/64.01c4bf37.js"><link rel="prefetch" href="/share/assets/js/65.0f31fd4b.js"><link rel="prefetch" href="/share/assets/js/66.55dbbe80.js"><link rel="prefetch" href="/share/assets/js/67.fd9ba6df.js"><link rel="prefetch" href="/share/assets/js/68.c6c9e158.js"><link rel="prefetch" href="/share/assets/js/69.91757641.js"><link rel="prefetch" href="/share/assets/js/7.b8928c33.js"><link rel="prefetch" href="/share/assets/js/70.12f0a894.js"><link rel="prefetch" href="/share/assets/js/71.88c99794.js"><link rel="prefetch" href="/share/assets/js/72.e1d99c59.js"><link rel="prefetch" href="/share/assets/js/73.aee6f06a.js"><link rel="prefetch" href="/share/assets/js/74.b47532b0.js"><link rel="prefetch" href="/share/assets/js/75.1f1ab66e.js"><link rel="prefetch" href="/share/assets/js/8.56deb6eb.js">
    <link rel="stylesheet" href="/share/assets/css/0.styles.d7affcea.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container" data-v-130b300a><div data-v-130b300a><div class="password-shadow password-wrapper-out" style="display:none;" data-v-25ba6db2 data-v-130b300a data-v-130b300a><h3 class="title" data-v-25ba6db2 data-v-25ba6db2>To Share</h3> <p class="description" data-v-25ba6db2 data-v-25ba6db2>分享风雨，享受阳光</p> <label id="box" class="inputBox" data-v-25ba6db2 data-v-25ba6db2><input type="password" value="" data-v-25ba6db2> <span data-v-25ba6db2>Konck! Knock!</span> <button data-v-25ba6db2>OK</button></label> <div class="footer" data-v-25ba6db2 data-v-25ba6db2><span data-v-25ba6db2><i class="iconfont reco-theme" data-v-25ba6db2></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-25ba6db2>vuePress-theme-reco</a></span> <span data-v-25ba6db2><i class="iconfont reco-copyright" data-v-25ba6db2></i> <a data-v-25ba6db2><!---->
            
          <span data-v-25ba6db2>2018 - </span>
          2022
        </a></span></div></div> <div class="hide" data-v-130b300a><header class="navbar" data-v-130b300a><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/share/" class="home-link router-link-active"><!----> <span class="site-name">To Share</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><i class="iconfont reco-search"></i> <input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/share/" class="nav-link"><i class="iconfont reco-home"></i>
  Home
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      Category
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/share/categories/docker/" class="nav-link"><i class="undefined"></i>
  docker
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/book/" class="nav-link"><i class="undefined"></i>
  book
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/flex/" class="nav-link"><i class="undefined"></i>
  flex
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/css/" class="nav-link"><i class="undefined"></i>
  css
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/git/" class="nav-link"><i class="undefined"></i>
  git
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/golang/" class="nav-link"><i class="undefined"></i>
  golang
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/gui/" class="nav-link"><i class="undefined"></i>
  gui
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/idea/" class="nav-link"><i class="undefined"></i>
  idea
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/js/" class="nav-link"><i class="undefined"></i>
  js
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/linux/" class="nav-link"><i class="undefined"></i>
  linux
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/mysql/" class="nav-link"><i class="undefined"></i>
  mysql
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/nodeJs/" class="nav-link"><i class="undefined"></i>
  nodeJs
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/php/" class="nav-link"><i class="undefined"></i>
  php
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/python/" class="nav-link"><i class="undefined"></i>
  python
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/site/" class="nav-link"><i class="undefined"></i>
  site
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/vue/" class="nav-link"><i class="undefined"></i>
  vue
</a></li></ul></div></div><div class="nav-item"><a href="/share/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  Tag
</a></div><div class="nav-item"><a href="/share/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  TimeLine
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      Docs
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/share/docs/git/" class="nav-link"><i class="undefined"></i>
  git
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/vue/" class="nav-link"><i class="undefined"></i>
  vue
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/flex/" class="nav-link"><i class="undefined"></i>
  css
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/js/" class="nav-link"><i class="undefined"></i>
  js
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/node/" class="nav-link"><i class="undefined"></i>
  nodeJs
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/docker/" class="nav-link"><i class="undefined"></i>
  docker
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/php/" class="nav-link"><i class="undefined"></i>
  php
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/linux/" class="nav-link router-link-active"><i class="undefined"></i>
  linux
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/python/" class="nav-link"><i class="undefined"></i>
  python
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/gui/" class="nav-link"><i class="undefined"></i>
  GUI
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/golang/" class="nav-link"><i class="undefined"></i>
  golang
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/idea/" class="nav-link"><i class="undefined"></i>
  idea
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/site/" class="nav-link"><i class="undefined"></i>
  site
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/book/" class="nav-link"><i class="undefined"></i>
  book
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/mysql/" class="nav-link"><i class="undefined"></i>
  mysql
</a></li></ul></div></div><div class="nav-item"><a href="https://gitee.com/zenglingchuan" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-mayun"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-130b300a></div> <aside class="sidebar" data-v-130b300a><div class="personal-info-wrapper" data-v-39576ba9 data-v-130b300a><img src="/share/avatar.png" alt="author-avatar" class="personal-img" data-v-39576ba9> <!----> <div class="num" data-v-39576ba9><div data-v-39576ba9><h3 data-v-39576ba9>63</h3> <h6 data-v-39576ba9>文章</h6></div> <div data-v-39576ba9><h3 data-v-39576ba9>51</h3> <h6 data-v-39576ba9>标签</h6></div></div> <ul class="social-links" data-v-39576ba9></ul> <hr data-v-39576ba9></div> <nav class="nav-links"><div class="nav-item"><a href="/share/" class="nav-link"><i class="iconfont reco-home"></i>
  Home
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      Category
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/share/categories/docker/" class="nav-link"><i class="undefined"></i>
  docker
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/book/" class="nav-link"><i class="undefined"></i>
  book
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/flex/" class="nav-link"><i class="undefined"></i>
  flex
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/css/" class="nav-link"><i class="undefined"></i>
  css
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/git/" class="nav-link"><i class="undefined"></i>
  git
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/golang/" class="nav-link"><i class="undefined"></i>
  golang
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/gui/" class="nav-link"><i class="undefined"></i>
  gui
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/idea/" class="nav-link"><i class="undefined"></i>
  idea
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/js/" class="nav-link"><i class="undefined"></i>
  js
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/linux/" class="nav-link"><i class="undefined"></i>
  linux
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/mysql/" class="nav-link"><i class="undefined"></i>
  mysql
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/nodeJs/" class="nav-link"><i class="undefined"></i>
  nodeJs
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/php/" class="nav-link"><i class="undefined"></i>
  php
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/python/" class="nav-link"><i class="undefined"></i>
  python
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/site/" class="nav-link"><i class="undefined"></i>
  site
</a></li><li class="dropdown-item"><!----> <a href="/share/categories/vue/" class="nav-link"><i class="undefined"></i>
  vue
</a></li></ul></div></div><div class="nav-item"><a href="/share/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  Tag
</a></div><div class="nav-item"><a href="/share/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  TimeLine
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      Docs
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/share/docs/git/" class="nav-link"><i class="undefined"></i>
  git
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/vue/" class="nav-link"><i class="undefined"></i>
  vue
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/flex/" class="nav-link"><i class="undefined"></i>
  css
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/js/" class="nav-link"><i class="undefined"></i>
  js
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/node/" class="nav-link"><i class="undefined"></i>
  nodeJs
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/docker/" class="nav-link"><i class="undefined"></i>
  docker
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/php/" class="nav-link"><i class="undefined"></i>
  php
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/linux/" class="nav-link router-link-active"><i class="undefined"></i>
  linux
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/python/" class="nav-link"><i class="undefined"></i>
  python
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/gui/" class="nav-link"><i class="undefined"></i>
  GUI
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/golang/" class="nav-link"><i class="undefined"></i>
  golang
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/idea/" class="nav-link"><i class="undefined"></i>
  idea
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/site/" class="nav-link"><i class="undefined"></i>
  site
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/book/" class="nav-link"><i class="undefined"></i>
  book
</a></li><li class="dropdown-item"><!----> <a href="/share/docs/mysql/" class="nav-link"><i class="undefined"></i>
  mysql
</a></li></ul></div></div><div class="nav-item"><a href="https://gitee.com/zenglingchuan" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-mayun"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <!----></nav> <ul class="sidebar-links"><li><a href="/share/docs/linux/" aria-current="page" class="sidebar-link">linux常用操作</a></li><li><a href="/share/docs/linux/lnmp.html" class="sidebar-link">LNMP环境</a></li><li><a href="/share/docs/linux/lua.html" class="sidebar-link">Lua环境</a></li><li><a href="/share/docs/linux/work.html" aria-current="page" class="active sidebar-link">DevOps</a></li></ul> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-25ba6db2 data-v-130b300a><h3 class="title" data-v-25ba6db2 data-v-25ba6db2>DevOps</h3> <!----> <label id="box" class="inputBox" data-v-25ba6db2 data-v-25ba6db2><input type="password" value="" data-v-25ba6db2> <span data-v-25ba6db2>Konck! Knock!</span> <button data-v-25ba6db2>OK</button></label> <div class="footer" data-v-25ba6db2 data-v-25ba6db2><span data-v-25ba6db2><i class="iconfont reco-theme" data-v-25ba6db2></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-25ba6db2>vuePress-theme-reco</a></span> <span data-v-25ba6db2><i class="iconfont reco-copyright" data-v-25ba6db2></i> <a data-v-25ba6db2><!---->
            
          <span data-v-25ba6db2>2018 - </span>
          2022
        </a></span></div></div> <div data-v-130b300a><main class="page"><section><div class="page-title"><h1 class="title">DevOps</h1> <div data-v-f875f3fc><!----> <i class="iconfont reco-date" data-v-f875f3fc><span data-v-f875f3fc>2022/9/10</span></i> <!----> <i class="tags iconfont reco-tag" data-v-f875f3fc><span class="tag-item" data-v-f875f3fc>linux</span><span class="tag-item" data-v-f875f3fc>nginx</span></i></div></div> <div class="theme-reco-content content__default"><div id="boxx" data-v-f4ca0dac><div data-v-f4ca0dac><p v-if="true" class="custom-block-title" data-v-f4ca0dac></p> <p v-if="true" data-v-f4ca0dac></p></div></div> <h2 id="linux查找文件"><a href="#linux查找文件" class="header-anchor">#</a> linux查找文件</h2> <blockquote><p>在根目录下, 查找文件名称以<code>-json.log</code>结尾的所有文件</p></blockquote> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">find</span> / -name *-json.log
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h2 id="查看命令是否执行成功"><a href="#查看命令是否执行成功" class="header-anchor">#</a> 查看命令是否执行成功</h2> <blockquote><p>很多时候, 执行命令之后, 我们想知道它到底是否执行成功了</p></blockquote> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token builtin class-name">echo</span> <span class="token variable">$?</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p style="color:blue;font-weight:bolder;">echo $?          ==&gt;  如果返回值为` 0 `代表执行成功，否则失败</p> <h2 id="centos7利用yum安装mysql-8-0-12"><a href="#centos7利用yum安装mysql-8-0-12" class="header-anchor">#</a> centos7利用yum安装mysql 8.0.12</h2> <h3 id="清理原有的mysql"><a href="#清理原有的mysql" class="header-anchor">#</a> 清理原有的mysql</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">rpm</span> -qa <span class="token operator">|</span> <span class="token function">grep</span> mysql
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>可能会显示</p> <div class="language-text line-numbers-mode"><pre class="language-text"><code>mysql-community-libs-8.0.12-1.el7.x86_64
mysql80-community-release-el7-1.noarch
mysql-community-client-8.0.12-1.el7.x86_64
mysql-community-common-8.0.12-1.el7.x86_64
mysql-community-server-8.0.12-1.el7.x86_64
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><p>通过下面的命令进行删除</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>yum remove mysql-xxx-xxx-
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>查找mysql的相关文件</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">find</span> / -name mysql
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>根据自身的需求删除mysql的配置文件信息</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">rm</span> -rf /var/lib/mysql
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="删除centos7默认的数据库mariadb"><a href="#删除centos7默认的数据库mariadb" class="header-anchor">#</a> 删除CentOS7默认的数据库mariadb</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">rpm</span> -qa <span class="token operator">|</span> <span class="token function">grep</span> mariadb
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>查找mariadb, 可能出现的结果</p> <div class="language-text line-numbers-mode"><pre class="language-text"><code>mariadb-libs-5.5.68-1.el7.x86_64
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>将查找出来的结果进行强制删除</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">rpm</span> -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="下载mysql-yum源"><a href="#下载mysql-yum源" class="header-anchor">#</a> 下载mysql yum源</h3> <p><a href="https://dev.mysql.com/downloads/repo/yum/" target="_blank" rel="noopener noreferrer">源地址<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <img src="/share/linux/28.png" alt="foo"> <p>点击download进入下载页面, 鼠标悬浮在 “No thanks, just start my download.”可查看mysql yum源的地址，选中右键复制链接地址进行下载</p> <ol><li>切换到mysql目录(自己创建的)</li></ol> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token builtin class-name">cd</span> /opt/mysql 
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ol start="2"><li>下载yum源</li></ol> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">wget</span> https://dev.mysql.com/get/mysql80-community-release-el7-7.noarch.rpm
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ol start="3"><li>安装yum源</li></ol> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>yum localinstall mysql80-community-release-el7-7.noarch.rpm
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ol start="4"><li>更新yum源</li></ol> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>yum clean all
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ol start="5"><li>把yum源包缓存下来</li></ol> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>yum makecache
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ol start="6"><li>开始安装mysql</li></ol> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>yum <span class="token function">install</span> mysql-community-server
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ol start="7"><li>启动mysql</li></ol> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>systemctl start mysqld 
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ol start="8"><li>启动成功后可以查看初始化密码随机生成的</li></ol> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">cat</span> /var/log/mysqld.log <span class="token operator">|</span> <span class="token function">grep</span> password
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ol start="9"><li>登录MySQL修改mysql用户密码</li></ol> <blockquote><p>这里修改为 <code>root123456</code></p></blockquote> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>ALTER <span class="token environment constant">USER</span> <span class="token string">'root'</span>@<span class="token string">'localhost'</span> IDENTIFIED BY <span class="token string">'root123456'</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>修改密码报错: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements</p> <p>这个错误是密码过于简单, 设置不成功, 不符合密码验证安全策略, 可通过以下命令修改为LOW(低),最简单的方式就是仿造初始化密码, 编一个类似的,就可以修改成功</p> <p><a href="https://gitee.com/zenglingchuan/wiki/wikis/Mysql/Mysql%E6%B7%BB%E5%8A%A0%E6%8E%88%E6%9D%83%E7%94%A8%E6%88%B7" target="_blank" rel="noopener noreferrer">授权账号设置<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p><a href="https://www.yisu.com/zixun/173065.html" target="_blank" rel="noopener noreferrer">'参考'<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p>[]</p> <h2 id="cli命令行模式查看php-ini位置"><a href="#cli命令行模式查看php-ini位置" class="header-anchor">#</a> cli命令行模式查看php.ini位置</h2> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>php -i <span class="token operator">|</span> <span class="token function">grep</span> php.ini
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h2 id="cli命令行模式查看扩展是否存在"><a href="#cli命令行模式查看扩展是否存在" class="header-anchor">#</a> cli命令行模式查看扩展是否存在</h2> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">cat</span> /etc/opt/remi/php80/php.ini <span class="token operator">|</span> <span class="token function">grep</span> swoole.so
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><img src="/share/linux/27.png" alt="foo"> <h2 id="php-ini优化"><a href="#php-ini优化" class="header-anchor">#</a> php.ini优化</h2> <div class="language-ini line-numbers-mode"><pre class="language-ini"><code>//默认情况下服务器对上传文件的大小是有限制的，如果想修改上传文件的限制可以修改php.ini文件
<span class="token key attr-name">file_uploads</span> <span class="token punctuation">=</span> <span class="token value attr-value">On; //是否允许上传文件</span> 
<span class="token key attr-name">upload_max_filesize</span> <span class="token punctuation">=</span> <span class="token value attr-value">1024M; //上传文件的最大限制</span>

<span class="token key attr-name">post_max_size</span> <span class="token punctuation">=</span> <span class="token value attr-value">1024M; //通过post提交的最多数据</span>

<span class="token key attr-name">max_execution_time</span> <span class="token punctuation">=</span> <span class="token value attr-value">300; //脚本最长的执行时间 单位为秒</span>
<span class="token key attr-name">max_input_time</span> <span class="token punctuation">=</span> <span class="token value attr-value">30000; //接收提交的数据的时间限制 单位为秒</span>
<span class="token key attr-name">memory_limit</span> <span class="token punctuation">=</span> <span class="token value attr-value">256M; //每个脚本使用的最大内存  ;在安全模式下，你不能用ini_set()在运行时改变这个设置。</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><h2 id="php-fpm优化"><a href="#php-fpm优化" class="header-anchor">#</a> php-fpm优化</h2> <blockquote><p>Nginx是为处理巨大的工作负载而构建的。 它能够同时处理成千上万的连接，但是如果您的PHP设置不合理，那么您将浪费很多资源，因为Nginx必须等待PHP完成当前处理之后才可以接受下一个请求，最终Nginx不能为您的服务提供任何优势！</p></blockquote> <p style="color:#0000FF;font-weight:bolder;">配置文件名称, 不同的安装方式, 文件所处的位置不同</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>php-fpm.conf
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>进程id所在的文件</li></ul> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>pid <span class="token operator">=</span> /var/opt/remi/php82/run/php-fpm/php-fpm.pid
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>存储日志的文件</li></ul> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>error_log <span class="token operator">=</span> /var/opt/remi/php82/log/php-fpm/error.log
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p style="color:#0000FF;font-weight:bolder;">优化: 添加三个变量</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>emergency_restart_threshold <span class="token number">10</span>
emergency_restart_interval 1m
process_control_timeout 10s
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><ol><li><p>前两个选项的设置是警告性的，它们告诉 php-fpm 进程，如果10个子进程在一分钟内失败，主 php-fpm 进程应该重新启动自己。  这听起来可能不够稳健，但是 PHP 是一个短暂的进程，它会泄漏内存，所以在出现高故障时重新启动主进程可以解决很多问题。</p></li> <li><p>第三个选项是 process_control_timeout，它告诉子进程在执行从父进程接收到的信号之前需要等待这么长的时间。这个设置是非常有用的。例如，当父进程发送终止信号时，子进程正在处理某些事情的时候。十秒的时间,他们会有一个更好的机会完成任务并且优雅地退出。</p></li></ol> <p style="color:purple;font-weight:bolder;">上面还不是 php-fpm 的核心配置; 这是因为，为了 web 请求服务，php-fpm 创建了一个新的进程池，它将具有一个单独的配置。 进程池的名称是 `  www  `，我想编辑的文件是 `  vim /etc/opt/remi/php82/php-fpm.d/www.conf  ` </p> <div class="language-conf line-numbers-mode"><pre class="language-text"><code>; pool的名称;每个pool可以监听不同的sock、tcp/ip。那nginx有好几个站点，每个站点可以使用一个pool 
; 这样做的好处是当其中的一个php502（可能是php资源不够）了。如果所有的网站使用同一个池，那其中一个
; 网站发生一些故障，比如程序员写的一些程序有问题，就会把php资源耗尽，这样的结果就是其他站点的php也会502。
; 所以有必要把每一个站点隔离开，每个pool的名字要唯一。
[www]

; user和group参数告诉我们服务器进程以 apache 的形式运行, 
; 如果您在设置网站时遇到文件权限问题，您可能要将目录的所有者或组更改为 apache，
; 从而允许PHP进程写入日志文件和上传文档等。
user = apache
group = apache
listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1
; php-fpm.conf 
; 优化1 pm = dynamic 指定php-fpm在任何给定时间点会保持活动的最小以及最大进程数量。
pm = dynamic
; php-fpm进程启动模式，pm可以设置为static和dynamic和ondemand
; 如果选择static，则进程数就数固定的，由pm.max_children指定固定的子进程数。
; 如果选择dynamic，则进程数是动态变化的,由以下参数决定：
; 优化2  静态方式下开启的php-fpm进程数量
pm.max_children = 300
; 动态方式下的起始php-fpm进程数量
pm.start_servers = 20
; 动态方式下 保证空闲进程数最小值，如果空闲进程小于此值，则创建新的子进程
pm.min_spare_servers = 5
; 动态方式下 保证空闲进程数最大值，如果空闲进程大于此值，此进行清理
pm.max_spare_servers = 35
; 最大请求处理数
pm.max_requests = 1024
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br></div></div><h2 id="nginx服务器http重定向https"><a href="#nginx服务器http重定向https" class="header-anchor">#</a> nginx服务器http重定向https</h2> <blockquote><p>由于http和https共存在一个配置文件里, 访问http的时候直接跳转到https</p></blockquote> <div class="language-config line-numbers-mode"><pre class="language-text"><code>server
{
    listen 80;
    listen 443 ssl;
    server_name test.com;
      

   # error_page   404   /404.html;

    ssl_certificate  /etc/nginx/cert/test.com_nginx/test.com_bundle.crt;
    ssl_certificate_key  /etc/nginx/cert/test.com_nginx/test.com.key;
    ssl_session_timeout 5m
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;


    location / { 
        root  /home/wwwroot/test; 
        index index.php index.htm index.html default.html default.htm default.php;
        #  laravel伪静态
    	#  if (!-e $request_filename) {
        #    	 rewrite  ^(.*)$  /index.php?s=$1  last;
 		#        break;
    	#  }

        # http 301重定向都https

        if ($scheme = &quot;http&quot;){
            return 301 https://$server_name$request_uri;
        }
    }          
    # 禁止访问admin模块
    # location /admin {
    #	 deny all;
    # }
   
          
    location ~ \.php(.*)$ {
         try_files $uri =404;      
         # 支持支http协议, 不要用  fastcgi_pass unix:/tmp/php-cgi.sock
         fastcgi_pass 127.0.0.1:9000;
         fastcgi_index index.php;
         # /home/wwwroot/test 项目运行目录
         fastcgi_param  SCRIPT_FILENAME   /home/wwwroot/test$fastcgi_script_name;       
         fastcgi_param  QUERY_STRING       $query_string;
         fastcgi_param  REQUEST_METHOD     $request_method;
         fastcgi_param  CONTENT_TYPE       $content_type;
         fastcgi_param  CONTENT_LENGTH     $content_length;

         fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
         fastcgi_param  REQUEST_URI        $request_uri;
         fastcgi_param  DOCUMENT_URI       $document_uri;
         fastcgi_param  DOCUMENT_ROOT      $document_root;
         fastcgi_param  SERVER_PROTOCOL    $server_protocol;
         fastcgi_param  REQUEST_SCHEME     $scheme;
         fastcgi_param  HTTPS              $https if_not_empty;

         fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
         fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

         fastcgi_param  REMOTE_ADDR        $remote_addr;
         fastcgi_param  REMOTE_PORT        $remote_port;
         fastcgi_param  SERVER_ADDR        $server_addr;
         fastcgi_param  SERVER_PORT        $server_port;
         fastcgi_param  SERVER_NAME        $server_name;

         fastcgi_param  REDIRECT_STATUS    200;



    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
    }

    location ~ .*\.(js|css)?$
    {
        expires      12h;
    }

    location ~ /.well-known {
        allow all;
    }

    location ~ /\.
    {
        deny all;
    }

    access_log off;
}

</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br><span class="line-number">63</span><br><span class="line-number">64</span><br><span class="line-number">65</span><br><span class="line-number">66</span><br><span class="line-number">67</span><br><span class="line-number">68</span><br><span class="line-number">69</span><br><span class="line-number">70</span><br><span class="line-number">71</span><br><span class="line-number">72</span><br><span class="line-number">73</span><br><span class="line-number">74</span><br><span class="line-number">75</span><br><span class="line-number">76</span><br><span class="line-number">77</span><br><span class="line-number">78</span><br><span class="line-number">79</span><br><span class="line-number">80</span><br><span class="line-number">81</span><br><span class="line-number">82</span><br><span class="line-number">83</span><br><span class="line-number">84</span><br><span class="line-number">85</span><br><span class="line-number">86</span><br><span class="line-number">87</span><br><span class="line-number">88</span><br><span class="line-number">89</span><br><span class="line-number">90</span><br><span class="line-number">91</span><br><span class="line-number">92</span><br><span class="line-number">93</span><br><span class="line-number">94</span><br><span class="line-number">95</span><br></div></div><h2 id="nginx301重定向"><a href="#nginx301重定向" class="header-anchor">#</a> nginx301重定向</h2> <blockquote><p>当域名不能用的时候, 可以301重定向到其他地方; 比如访问test.com, 重定向到www.test.top</p></blockquote> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>
server
<span class="token punctuation">{</span>
    listen <span class="token number">80</span><span class="token punctuation">;</span>
    server_name test.com www.test.com<span class="token punctuation">;</span>
    root  /home/test<span class="token punctuation">;</span> 

    <span class="token builtin class-name">return</span> <span class="token number">301</span> <span class="token variable">$scheme</span>://www.test.top<span class="token variable">$request_uri</span><span class="token punctuation">;</span>
    access_log off<span class="token punctuation">;</span>
<span class="token punctuation">}</span>

</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br></div></div><h2 id="杀死指定进程"><a href="#杀死指定进程" class="header-anchor">#</a> 杀死指定进程</h2> <p style="color:#0000FF;font-weight:bolder;">杀死nginx进程</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">ps</span> -ef <span class="token operator">|</span> <span class="token function">grep</span> nginx <span class="token operator">|</span> <span class="token function">cut</span> -c <span class="token number">9</span>-15 <span class="token operator">|</span> <span class="token function">xargs</span> <span class="token function">kill</span> -s <span class="token number">9</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p style="color:#0000FF;font-weight:bolder;">说明:</p> <ul><li><code>grep nginx</code> :  的输出结果是，所有含有关键字“nginx”的进程;</li> <li><code>cut -c 9-15</code> :  是截取输入行的第9个字符到第15个字符，而这正好是进程号PID;</li> <li><code>xargs kill -s 9</code> : 中的<code>xargs</code>命令是用来把前面命令的输出结果（PID）作为“kill -s 9”命令的参数，并执行该命令。“kill -s 9”会强行杀掉指定进程。</li></ul> <h2 id="linux递归创建目录"><a href="#linux递归创建目录" class="header-anchor">#</a> linux递归创建目录</h2> <blockquote><p>以创建<code>/etc/nginx/conf.d</code> 为例, 在默认情况下，你需要一层一层的创建各个目录，而使用 <code>-p</code> 选项，则系统会自动帮你创建 <code>/etc</code> 、<code>/etc/nginx</code> 、<code>/etc/nginx/conf.d</code></p></blockquote> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">mkdir</span> -p /etc/nginx/conf.d
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h2 id="查看设置开机启动的服务"><a href="#查看设置开机启动的服务" class="header-anchor">#</a> 查看设置开机启动的服务</h2> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>systemctl list-units --type<span class="token operator">=</span>service
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h2 id="查看当前linux网络监听情况"><a href="#查看当前linux网络监听情况" class="header-anchor">#</a> 查看当前linux网络监听情况</h2> <p>经常会用这个命令, 当配置出现问题的时候</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">netstat</span> -ntlp
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h2 id="清空一个文件"><a href="#清空一个文件" class="header-anchor">#</a> 清空一个文件</h2> <blockquote><p>比如, 要情况日志文件 error.log</p></blockquote> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">cat</span> /dev/null <span class="token operator">&gt;</span> error.log
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h2 id="查看文件大小"><a href="#查看文件大小" class="header-anchor">#</a> 查看文件大小</h2> <h3 id="查看目录下所有文件的大小-并按从大到小排序"><a href="#查看目录下所有文件的大小-并按从大到小排序" class="header-anchor">#</a> 查看目录下所有文件的大小,并按从大到小排序</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">du</span> -sh * <span class="token operator">|</span> <span class="token function">sort</span> -rh
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="查看当前目录总大小"><a href="#查看当前目录总大小" class="header-anchor">#</a> 查看当前目录总大小</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">du</span> -sh
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="查看当前目录下各个文件及目录占用空间大小"><a href="#查看当前目录下各个文件及目录占用空间大小" class="header-anchor">#</a> 查看当前目录下各个文件及目录占用空间大小</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">du</span> -sh * 
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="查看该文件大小"><a href="#查看该文件大小" class="header-anchor">#</a> 查看该文件大小</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">du</span> -sh <span class="token punctuation">[</span>文件<span class="token punctuation">]</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h2 id="显示文件系统的磁盘使用情况统计"><a href="#显示文件系统的磁盘使用情况统计" class="header-anchor">#</a> 显示文件系统的磁盘使用情况统计</h2> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">df</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></div></section> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">Last Updated: </span> <span class="time">2022/10/10 16:25:20</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev"><a href="/share/docs/linux/lua.html" class="prev">
            Lua环境
          </a></span> <!----></p></div> <div class="comments-wrapper"><!----></div> <ul class="side-bar sub-sidebar-wrapper" style="width:12rem;" data-v-cb1513f6><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#linux查找文件" class="sidebar-link reco-side-linux查找文件" data-v-cb1513f6>linux查找文件</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#查看命令是否执行成功" class="sidebar-link reco-side-查看命令是否执行成功" data-v-cb1513f6>查看命令是否执行成功</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#centos7利用yum安装mysql-8-0-12" class="sidebar-link reco-side-centos7利用yum安装mysql-8-0-12" data-v-cb1513f6>centos7利用yum安装mysql 8.0.12</a></li><li class="level-3" data-v-cb1513f6><a href="/share/docs/linux/work.html#清理原有的mysql" class="sidebar-link reco-side-清理原有的mysql" data-v-cb1513f6>清理原有的mysql</a></li><li class="level-3" data-v-cb1513f6><a href="/share/docs/linux/work.html#删除centos7默认的数据库mariadb" class="sidebar-link reco-side-删除centos7默认的数据库mariadb" data-v-cb1513f6>删除CentOS7默认的数据库mariadb</a></li><li class="level-3" data-v-cb1513f6><a href="/share/docs/linux/work.html#下载mysql-yum源" class="sidebar-link reco-side-下载mysql-yum源" data-v-cb1513f6>下载mysql yum源</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#cli命令行模式查看php-ini位置" class="sidebar-link reco-side-cli命令行模式查看php-ini位置" data-v-cb1513f6>cli命令行模式查看php.ini位置</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#cli命令行模式查看扩展是否存在" class="sidebar-link reco-side-cli命令行模式查看扩展是否存在" data-v-cb1513f6>cli命令行模式查看扩展是否存在</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#php-ini优化" class="sidebar-link reco-side-php-ini优化" data-v-cb1513f6>php.ini优化</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#php-fpm优化" class="sidebar-link reco-side-php-fpm优化" data-v-cb1513f6>php-fpm优化</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#nginx服务器http重定向https" class="sidebar-link reco-side-nginx服务器http重定向https" data-v-cb1513f6>nginx服务器http重定向https</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#nginx301重定向" class="sidebar-link reco-side-nginx301重定向" data-v-cb1513f6>nginx301重定向</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#杀死指定进程" class="sidebar-link reco-side-杀死指定进程" data-v-cb1513f6>杀死指定进程</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#linux递归创建目录" class="sidebar-link reco-side-linux递归创建目录" data-v-cb1513f6>linux递归创建目录</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#查看设置开机启动的服务" class="sidebar-link reco-side-查看设置开机启动的服务" data-v-cb1513f6>查看设置开机启动的服务</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#查看当前linux网络监听情况" class="sidebar-link reco-side-查看当前linux网络监听情况" data-v-cb1513f6>查看当前linux网络监听情况</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#清空一个文件" class="sidebar-link reco-side-清空一个文件" data-v-cb1513f6>清空一个文件</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#查看文件大小" class="sidebar-link reco-side-查看文件大小" data-v-cb1513f6>查看文件大小</a></li><li class="level-3" data-v-cb1513f6><a href="/share/docs/linux/work.html#查看目录下所有文件的大小-并按从大到小排序" class="sidebar-link reco-side-查看目录下所有文件的大小-并按从大到小排序" data-v-cb1513f6>查看目录下所有文件的大小,并按从大到小排序</a></li><li class="level-3" data-v-cb1513f6><a href="/share/docs/linux/work.html#查看当前目录总大小" class="sidebar-link reco-side-查看当前目录总大小" data-v-cb1513f6>查看当前目录总大小</a></li><li class="level-3" data-v-cb1513f6><a href="/share/docs/linux/work.html#查看当前目录下各个文件及目录占用空间大小" class="sidebar-link reco-side-查看当前目录下各个文件及目录占用空间大小" data-v-cb1513f6>查看当前目录下各个文件及目录占用空间大小</a></li><li class="level-3" data-v-cb1513f6><a href="/share/docs/linux/work.html#查看该文件大小" class="sidebar-link reco-side-查看该文件大小" data-v-cb1513f6>查看该文件大小</a></li><li class="level-2" data-v-cb1513f6><a href="/share/docs/linux/work.html#显示文件系统的磁盘使用情况统计" class="sidebar-link reco-side-显示文件系统的磁盘使用情况统计" data-v-cb1513f6>显示文件系统的磁盘使用情况统计</a></li></ul></main> <!----></div></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-c6073ba8 data-v-c6073ba8><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-c6073ba8><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-c6073ba8></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-c6073ba8></path></svg></div><!----><div class="kanbanniang" data-v-5775ee02><div class="banniang-container" style="display:;" data-v-5775ee02><div class="messageBox" style="left:68px;bottom:370px;display:none;" data-v-5775ee02>
      欢迎来到我的博客
    </div> <div class="operation" style="right:90px;bottom:40px;display:none;" data-v-5775ee02><i class="kbnfont kbn-ban-home ban-home" data-v-5775ee02></i> <i class="kbnfont kbn-ban-message message" data-v-5775ee02></i> <i class="kbnfont kbn-ban-close close" data-v-5775ee02></i> <a target="_blank" href="https://vuepress-theme-reco.recoluan.com/views/plugins/kanbanniang.html" data-v-5775ee02><i class="kbnfont kbn-ban-info info" data-v-5775ee02></i></a> <i class="kbnfont kbn-ban-theme skin" style="display:;" data-v-5775ee02></i></div> <canvas id="banniang" width="260px" height="420" class="live2d" style="right:200px;bottom:20px;opacity:0.4;" data-v-5775ee02></canvas></div> <div class="showBanNiang" style="display:none;" data-v-5775ee02>
    看板娘
  </div></div><canvas id="vuepress-canvas-cursor"></canvas><!----><div class="RibbonAnimation"></div><!----></div></div>
    <script src="/share/assets/js/app.706684de.js" defer></script><script src="/share/assets/js/3.4685d505.js" defer></script><script src="/share/assets/js/1.b12738fb.js" defer></script><script src="/share/assets/js/53.c0420367.js" defer></script><script src="/share/assets/js/9.4e81f08e.js" defer></script>
  </body>
</html>
